
const {ccclass, property} = cc._decorator;

@ccclass
export default class BankItem extends cc.Component {

    @property(cc.Sprite)
    private icon:cc.Sprite = null;

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {}

    start () {
        this.node.on(cc.Node.EventType.TOUCH_END,this.onClickFunc,this);
    }

    private _data:any;
    public init(data:any):void
    {   
        this._data = data;
        cc.loader.loadRes(`shop/shop_${data['id']}`, cc.SpriteFrame, (err, spriteFrame)=>{
            this.icon.spriteFrame = spriteFrame;
        });
    }

    private onClickFunc():void
    {
       cc.warn("点击item",this._data.id); 
    }

    // update (dt) {}

    lateUpdate(){

    }

    private clean():void
    {   
        this.node.off(cc.Node.EventType.TOUCH_END,this.onClickFunc,this);
    }

    onDestroy(){
       
    }

    onEnable(){

    }

    onDisable(){

    }
}
